class TreeNode
    attr_accessor :parentNode, :value

    def initialize (value)
        @value = value
        @index = 0
        @childNodes = []
        @parentNode = nil
    end

    def childNodes
        @childNodes
    end

    def addChild (node)
        node.parentNode = self
        @childNodes[@index] = node
        @index += 1
        node
    end
end